package com.zy.orver;

import javafx.scene.Parent;

public class ChildClass extends ParentClass {//子类继承于父类
    private int c1 = 21;
    public int c2 = 22;

    private void cm1() {
        System.out.println("in cm1() c1=" + c1);
    }

    public void cm2() {
        System.out.println("in cm2() c2=" + c2);
    }

    public static void main(String args[]) {
        int i;//i =0
        ParentClass p = new ParentClass();
        i = p.f2; //i=2
         i = p.f3;//i=3
         i = p.f4;//i=4
        p.fm2();//in fm2() f2=2
         p.fm3();//in fm3 f3=3
         p.fm4();//in fm4 f4=4
        ChildClass c = new ChildClass();
        i = c.f2;//i=2
         i = c.f3;//i=3
         i = c.f4;//i=4
        i = c.c1;//i=21
         i = c.c2;//i=22
        c.cm1();//in cm1() c1=21
        c.cm2();//in cm2() c2=22
        c.fm2();//
        c.fm3();
        c.fm4();

    }

}
